Imports NHibernate.Criterion
Imports NHibernate
Imports FrameworkNHibernate
Imports FrameworkNHibernate.Dal
Imports Spring.Transaction
Imports Spring.Transaction.Interceptor

Public Class FuncionarioDao
    Inherits GenericsNHibernateDao(Of Funcionario)
    Implements IFuncionarioDao

    <Transaction(TransactionPropagation.Supports, ReadOnly:=True)> _
    Public Function BuscarPorCPF(ByVal _cpf As String) As System.Collections.Generic.IList(Of Funcionario) Implements IFuncionarioDao.BuscarPorCPF

        Dim _criterio As ICriteria = MyBase.CurrentSession.CreateCriteria(GetType(Funcionario))

        _criterio.Add(Expression.Like("CPF", _cpf))

        Return _criterio.List(Of Funcionario)()

    End Function

    <Transaction(TransactionPropagation.Supports, ReadOnly:=True)> _
    Public Function BuscarPorNome(ByVal _nome As String) As System.Collections.Generic.IList(Of Funcionario) Implements IFuncionarioDao.BuscarPorNome

        Dim _criterio As ICriteria = MyBase.CurrentSession.CreateCriteria(GetType(Funcionario))

        _criterio.Add(Expression.Eq("Nome", _nome))

        Return _criterio.List(Of Funcionario)()

    End Function


End Class


